<!-- 以下代码为代码生成器生成，生成时间: 2018-01-28 16:52:19，作者：billjiang/475572229@qq.com-->
<section class="content-header">
    <h1>
        学生管理管理
        <small>列表</small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="${basePath}"><i class="fa fa-dashboard"></i> 首页</a></li>
        <li><a href="#">系统工具</a></li>
        <li class="active">学生管理管理</li>
    </ol>
</section>

<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <!-- /.box-header -->
                <div class="dataTables_filter" id="searchDiv" style="display: none">
                    <!--查询条件-->
                    <input type="search" placeholder="请输入姓名" title="姓名" name="name"
                                           class="form-control" id="name" operator="like" likeOption="true">
                    <input type="search" placeholder="请输入编码" title="编码" name="code"
                                           class="form-control" id="code" operator="like" likeOption="true">
                    <input type="search" placeholder="请输入性别" title="性别" name="sex"
                                           class="form-control" id="sex" operator="like" likeOption="true">
                    <div class="btn-group">
                        <button type="button" class="btn btn-primary" data-btn-type="search">查询</button>
                        <button type="button" class="btn btn-default" data-btn-type="reset">重置</button>
                    </div>
                    <div class="btn-group">
                        <button type="button" class="btn btn-default" data-btn-type="add">新增</button>
                        <button type="button" class="btn btn-default" data-btn-type="edit">编辑</button>
                        <button type="button" class="btn btn-default" data-btn-type="delete">删除</button>
                    </div>
                </div>
                <div class="box-body">
                    <table id="student_table" class="table table-bordered table-striped table-hover">
                    </table>
                </div>
            </div>
        </div>
    </div>
</section>

<script>
    var studentTable, winId = "studentWin";
    $(function (){
        studentTable = new CommonTable("student_table", "student", "searchDiv", null);
        //绑定按钮事件
        $("button[data-btn-type]").click(function () {
            var action = $(this).data("btn-type");
            var rowId = studentTable.getSelectedRowId();
            switch (action) {
                case "add":
                    modals.openWin({
                        winId: winId,
                        title: '新增学生管理',
                        width: "900px",
                        url: basePath + "/student/edit"
                    })
                    break;
                case "edit":
                    if (!rowId) {
                        modals.info('请选择要编辑的行');
                        return false;
                    }
                    modals.openWin({
                        winId: winId,
                        title: '编辑学生管理【' + studentTable.getSelectedRowData().name + '】',
                        width: '900px',
                        url: basePath + "/student/edit?id=" + rowId
                    });
                    break;
                case 'delete':
                    if (!rowId) {
                        modals.info('请选择要删除的行');
                        return false;
                    }
                    modals.confirm("是否要删除该行数据？", function () {
                        ajaxPost(basePath + "/student/delete/" + rowId, null, function (data) {
                            if (data.success) {
                                studentTable.reloadRowData();
                            } else {
                                modals.info("学生管理数据被引用，不可删除！");
                            }
                        });
                    })
                    break;
            }
        })
    })
</script>